package com.example.Controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.Service.impl.HeadlineServiceImpl;
import com.example.dao.HeadlineMapper;
import com.example.pojo.Headline;
import com.example.pojo.Pop;
import com.example.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/headline")
public class HeadlineController {

    @Autowired
    private HeadlineServiceImpl headlineService;

    @Autowired
    private HeadlineMapper headlineMapper;

    @GetMapping("/selectHeadlineNameByType")
    public Result selectByHeadlineName(@RequestParam(value = "type") String type) {
        QueryWrapper<Headline> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("type",type);
        List<Headline> headlineList = headlineMapper.selectList(queryWrapper);
        return new Result("200","查询成功",headlineList);
    }


}
